<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增文章')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-cmsArticle-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">文章标题：</label>
				<div class="col-sm-8">
					<input id="title" name="title" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">文章内容：</label>
				<div class="col-sm-8">
					<!--<input id="content" name="content" class="form-control" type="text">-->
                    <textarea hidden id="content" name="content" style=""></textarea>

                    <div id="editor">
                        <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
                    </div>


				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">创建者：</label>
				<div class="col-sm-8">
					<input id="createBy" name="createBy" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">创建时间：</label>
				<div class="col-sm-8">
					<input id="createTime" name="createTime" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">更新者：</label>
				<div class="col-sm-8">
					<input id="updateBy" name="updateBy" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">更新时间：</label>
				<div class="col-sm-8">
					<input id="updateTime" name="updateTime" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>

    <script type="text/javascript" src="https://unpkg.com/wangeditor/release/wangEditor.min.js"></script>
    <script type="text/javascript">
		var prefix = ctx + "system/cmsArticle"
		$("#form-cmsArticle-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-cmsArticle-add').serialize());
	        }
	    }

        $(document).ready(function () {
            var E = window.wangEditor
            var editor = new E('#editor')
            var $content = $('#content')
            editor.customConfig.onchange = function (html) {
                // 监控变化，同步更新到 textarea
                $content.val(html)
            }
            editor.create()
            $content.val(editor.txt.html())
        })
	</script>
</body>
</html>
